﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" Culture="th-TH" uiCulture="th" AutoEventWireup="true" CodeBehind="PS_AbsenceTypes.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.PS_AbsenceTypes" %>

<asp:Content 
    ID="Content1" 
    runat="server" 
    contentplaceholderid="ContentPlaceHolder1">
    
    <title>ข้อมูลประเภทการลา</title>
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
    
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">        
            <script type="text/javascript">
                function RowDblClick(sender, eventArgs) {
                    sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
                }
                function isNumberKey(event)  // ตัวเลขอย่างเดียว
                {
                    var charCode = (event.which) ? event.which : event.keyCode
                    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
                        alert("กรุณากรอกข้อมูลที่เป็นตัวเลขเท่านั้น!")
                        return false;
                    }
                    return true;
                }
            </script>
        
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="cmdSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmdExpand">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1"
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmdCollapse">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadTreeView1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lblUpperText" />
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" 
                        LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
        Height="100%" Width="75px" Transparency="50">
        <table style="height: 100%; width: 100%" border="0">
            <tr>
                <td width="100%" align="center" valign="middle">
                    <img alt="Loading..." 
                        src="../Images/Buttons/loading.gif" 
                        style="border: 0px;" />
                </td>
            </tr>
        </table>
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
    </telerik:RadAjaxLoadingPanel> 
    <div class="Background980V2" style="width:980px; margin-top: 10px;">
        <table align="center" width="100%" >
            <tr>
                <td align="left" class="tableHeader">ข้อมูลประเภทการลา</td>
            </tr>
            <tr>
                <td>
                    <asp:Panel runat="server" Width="99%"   ScrollBars="Auto">
                        <telerik:RadGrid ID="RadGrid1" runat="server"
                            AllowAutomaticDeletes="True"
                            AllowFilteringByColumn="True"
                            AllowMultiRowEdit="True"
                            AllowMultiRowSelection="True"
                            AllowPaging="True"
                            AllowSorting="True"
                            AutoGenerateColumns="False"
                            EnableAJAX="True"
                            EnableAJAXLoadingTemplate="True"
                            GridLines="None"
                            OnItemCommand="RadGrid1_ItemCommand"
                            Skin="Outlook"
                            Width="99%">
                            <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1"
                                ClientDataKeyNames="Sequence"
                                CommandItemDisplay="Top"
                                DataKeyNames="Sequence"
                                InsertItemPageIndexAction="ShowItemOnCurrentPage"
                                NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                <CommandItemTemplate>
                                    <table width="100%">
                                        <tr>
                                            <td>
                                                <asp:LinkButton ID="cmdAddNew" runat="server" CausesValidation="False"
                                                    CommandName="InitInsert"
                                                    Visible="<%# !RadGrid1.MasterTableView.IsItemInserted && RadGrid1.EditIndexes.Count <= 0 %>">
                                <img style="border:0px;vertical-align:middle;" alt="" 
                                src="../Images/Buttons/AddRecord.gif" /> เพิ่มประเภทการลา</asp:LinkButton>
                                                &nbsp;&nbsp;
                                            </td>
                                            <td align="right"></td>
                                        </tr>
                                    </table>
                                </CommandItemTemplate>
                                <RowIndicatorColumn>
                                    <HeaderStyle Width="20px" />
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn>
                                    <HeaderStyle Width="20px" />
                                </ExpandCollapseColumn>

                                <Columns>
                                    <telerik:GridEditCommandColumn
                                        ButtonType="ImageButton"
                                        EditText="คลิกเพื่อแก้ไขรายการ"
                                        ItemStyle-Width="15">
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridEditCommandColumn>
                                    <telerik:GridButtonColumn
                                        ButtonType="ImageButton"
                                        CommandName="Delete"
                                        ConfirmDialogType="RadWindow"
                                        ConfirmText="ลบข้อมูลที่เลือก?"
                                        ItemStyle-Width="15"
                                        Text="คลิกเพื่อลบรายการ"
                                        UniqueName="column1">
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridButtonColumn>
                                    <telerik:GridBoundColumn
                                        DataField="Sequence"
                                        DataType="System.Int32"
                                        Display="False"
                                        HeaderText="Sequence"
                                        ReadOnly="True"
                                        UniqueName="Sequence"
                                        Visible="False">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn
                                        DataField="Name"
                                        HeaderText="ชื่อประเภทการลา"
                                        FilterControlWidth="100%"
                                        ShowFilterIcon="false"
                                        AutoPostBackOnFilter="true"
                                        UniqueName="Name">
                                        <HeaderStyle HorizontalAlign="Center" Width="300px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridTemplateColumn
                                        DataField="ApproveProcessName"
                                        HeaderText="ขออนุมัติโดยใช้คำขอประเภท"
                                        FilterControlWidth="100%"
                                        ShowFilterIcon="false"
                                        AutoPostBackOnFilter="true"
                                        UniqueName="ApproveProcessName">
                                        <HeaderStyle HorizontalAlign="Center" />
                                        <ItemStyle HorizontalAlign="Center" />
                                        <ItemTemplate>
                                            <asp:Literal runat="server" Text='<%# string.IsNullOrEmpty(Convert.ToString(Eval("ApproveProcessName"))) ? "(ค่าเริ่มต้น)": Convert.ToString(Eval("ApproveProcessName")) %>'></asp:Literal>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <%-- <telerik:GridBoundColumn 
                                DataField="DayAdvance" 
                                HeaderText="จำนวนวันที่ลาล่วงหน้า" 
                                UniqueName="DayAdvance">
                                <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                <ItemStyle HorizontalAlign="Center" />
                            </telerik:GridBoundColumn>
                            <telerik:GridCheckBoxColumn 
                                DataField="IncludeNWD" 
                                HeaderText="นับวันลาเฉพาะวันทำการ" 
                                FilterControlWidth = "100%"
                                ShowFilterIcon ="false"
                                AllowFiltering ="false"
                                UniqueName="IncludeNWD">
                                <HeaderStyle HorizontalAlign="Center" Width="100px"  />
                                <ItemStyle HorizontalAlign="Center" />
                            </telerik:GridCheckBoxColumn>--%>
                                    <telerik:GridBoundColumn
                                        DataField="Remarks"
                                        HeaderText="หมายเหตุ"
                                        FilterControlWidth="100%"
                                        ShowFilterIcon="false"
                                        AutoPostBackOnFilter="true"
                                        UniqueName="Remarks">
                                        <HeaderStyle HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                </Columns>
                                <EditFormSettings
                                    EditFormType="WebUserControl"
                                    UserControlName="../UserControls/PS_AbsenceTypes.ascx">
                                    <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
                                </EditFormSettings>
                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                            </MasterTableView>
                            <ClientSettings AllowColumnHide="True"
                                AllowColumnsReorder="True"
                                EnableRowHoverStyle="True"
                                ReorderColumnsOnClient="True">
                                <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                                <ClientEvents OnRowDblClick="RowDblClick" />
                            </ClientSettings>
                        </telerik:RadGrid>
                    </asp:Panel>
                </td>
            </tr>
        </table>
    </div> 
</asp:Content>
